﻿using Sgr.Domain.Repositories;

namespace Sgr.UPMS.Domain.Departments
{
    /// <summary>
    ///
    /// </summary>
    public interface IDepartmentRepository : ITreeNodeBaseRepositoryOfTEntityAndTPrimaryKey<Department, long>
    {
        /// <summary>
        /// 检查同级部门下是否存在相同名称
        /// </summary>
        /// <param name="orgId">组织标识</param>
        /// <param name="name">部门名称</param>
        /// <param name="parentId">父级部门ID</param>
        /// <param name="excludeId">需要排除的部门ID</param>
        /// <param name="cancellationToken">取消令牌</param>
        /// <returns>是否存在</returns>
        Task<bool> IsNameExistsInSameLevelAsync(
            long orgId,
            string name,
            long parentId,
            long? excludeId = null,
            CancellationToken cancellationToken = default);
    }
}